package com.ctshk.sapp.order.ship.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.TokenUser;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.ship.req.ShipManualOrderReq;
import com.ctshk.rpc.order.ship.service.IShipManualOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 船票手工单（外挂单） 前端控制器
 * </p>
 *
 * @author 刘蕾
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/ship-manual-order")
@Api(value = "外挂单",tags = "外挂单")
public class ShipManualOrderController extends BaseController {

    @DubboReference
    private IShipManualOrderService shipManualOrderService ;

    @ApiOperation(value="添加外挂单", notes="添加外挂单",tags = "外挂单")
    @OperationLogAnnotation(operModul = OperationLogModel.SHIP_ORDER, operType = OperationLogType.ADD, operTitle = "添加外挂单", operDesc = "添加外挂单")
    @PostMapping("/save")
    public Result saveShipManualOrder(@RequestBody @Valid ShipManualOrderReq shipManualOrderReq) {
        TokenUser user = getCurrentUser(getRequest());
        return shipManualOrderService.addShipManualOrder(shipManualOrderReq,user);
    }
}
